{% load i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
  <head>
    <title>{% trans "Séléctionnez la position géographique sur la carte" %}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key={{ GOOGLE_ID }}" type="text/javascript"></script>
    <script src="{{MEDIA_URL}}js/gmapselect.js" type="text/javascript"></script>
    <script type="text/javascript">
      if (window.attachEvent) {
          window.attachEvent("onload", function() {
              loadMap();  // Internet Explorer
              showPosition(47.635621, 6.859438);
          });
      } else {
          window.addEventListener("load", function() {
    	      loadMap(); // Firefox and standard browsers
              showPosition(47.635621, 6.859438);
          }, false);
      }

      function select_form(){
        window.parent.opener.document.getElementById("id_map_lat").value = document.getElementById("id_map_lat").value;
        window.parent.opener.document.getElementById("id_map_lon").value = document.getElementById("id_map_lon").value;
        window.close()
      }

    </script>
  </head>
  <body>
    <div id="map" style="width:350px; height:300px; margin: auto;"></div>
    <input id="id_map_lat" type="hidden" name="map_lat" value="" /><span id="text_lat"></span> - 
    <input id="id_map_lon" type="hidden" name="map_lon" value="" /><span id="text_long"></span>
    <input type="button" value="Sélectionner" onclick="select_form();"/>
  </body>
</html>
